﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Common;

namespace Common
{
    public static class JobManager
    {
        //Custom Thread Pool implementation
        private static ThreadPoolWait ThreadPoolWait = new ThreadPoolWait();

        public static void SetMaxThreads(int MaxNumOfThreads, int MinNumOfThreads)
        {
            //ThreadPool.SetMinThreads(1, 1);
            //ThreadPool.SetMaxThreads(MaxNumOfThreads, MaxNumOfThreads);
            //ThreadPool.SetMinThreads(MinNumOfThreads, MinNumOfThreads);

        }

        public static void AddJob(WaitCallback callBack, object parameter)
        {
            ThreadPoolWait.QueueUserWorkItem(callBack, parameter);

        }
        
        public static void WaitForAll()
        {
            ThreadPoolWait.WaitOne();
        }
    }
}
